Skip to content

feat(database_observability.postgres): Add configurable limit to pg_stat_statements query#5639

Merged
cristiangreco merged 1 commit into
mainfrom
cristian/dbo11y-pg-query-stmt-limit
Mar 13, 2026
Merged

feat(database_observability.postgres): Add configurable limit to pg_stat_statements query#5639
cristiangreco merged 1 commit into
mainfrom
cristian/dbo11y-pg-query-stmt-limit

Conversation

@cristiangreco
Copy link
Copy Markdown
Contributor

@cristiangreco cristiangreco commented Feb 24, 2026

Brief description of Pull Request

Allow configuring the number of statements collected from pg_stat_statements in the query_details collector. This allows (roughly) matching the number of statements set in the exporter.

Pull Request Details

Issue(s) fixed by this Pull Request

Fixes https://github.com/grafana/grafana-dbo11y-app/issues/2414

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

@cristiangreco cristiangreco force-pushed the cristian/dbo11y-pg-query-stmt-limit branch from e9665bd to 6e30467 Compare February 24, 2026 17:40
| Name | Type | Description | Default | Required |
|--------------------|------------|------------------------------------------------------|---------|----------|
| `collect_interval` | `duration` | How frequently to collect information from database. | `"1m"` | no |
| `statements_limit` | `integer` | Max number of recent queries to collect details for. | `100` | no |
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 matches the default value of postgres_exporter (and our previously hardcoded value)

@cristiangreco cristiangreco marked this pull request as ready for review February 24, 2026 17:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 24, 2026

💻 Deploy preview deleted (feat(database_observability.postgres): Add configurable limit to pg_stat_statements query).

@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Feb 26, 2026
@clayton-cornell
Copy link
Copy Markdown
Contributor

Small doc change. No suggestions from my side :-)

…tat_statements query

Allow configuring the number of statements collected from
`pg_stat_statements` in the `query_details` collector. This allows
(roughly) matching the number of statements set in the exporter.
@cristiangreco cristiangreco force-pushed the cristian/dbo11y-pg-query-stmt-limit branch from 6e30467 to 8644bc1 Compare March 13, 2026 10:25
@cristiangreco cristiangreco merged commit 0de0a3f into main Mar 13, 2026
49 checks passed
@cristiangreco cristiangreco deleted the cristian/dbo11y-pg-query-stmt-limit branch March 13, 2026 12:14
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age type/docs Docs Squad label across all Grafana Labs repos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants